To present the app-tracking authorization request to the end user, you need to call requestTrackingAuthorization(completionHandler:)
If calling requestTrackingAuthorization(completionHandler:) doesn't prompt the user for authorization, see below for various reasons that can cause this issue.
You are calling requestTrackingAuthorization(completionHandler:) while the app is inactive or in the background.
Starting with iOS 15, the app-tracking authorization request alert only appears if your app is active. Privacy prompts are displayed out of process, temporarily placing your app into the inactive state when they're displayed. If your app makes several privacy related authorizations in a row, the app-tracking authorization request is likely stacked behind another authorization prompt. It won't appear because requestTrackingAuthorization(completionHandler:)
was called while your app was either inactive or in the background.
You are calling requestTrackingAuthorization(completionHandler:) from an app extension.
The app-tracking authorization request alert doesn't appear when you call requestTrackingAuthorization(completionHandler:)
from an app extension.
The user has already provided a response to your request.
The user can approve or deny your app-tracking authorization request. The system remembers their choice and subsequent calls to requestTrackingAuthorization(completionHandler:)
don't prompt the user for access again unless the user uninstalls and then reinstalls your app on the device. Because the user can change your app's authorization status at any time using System, always check the trackingAuthorizationStatus property to determine the authorization status of your app and decide what the app should do next. Call requestTrackingAuthorization(completionHandler:)
to prompt the user for access if and only if trackingAuthorizationStatus
returns notDetermined.
It's best practice to wait to request authorization until the user attempts to use an app feature that requires access. Additionally, making several authorization requests in a row isn’t recommended. If your app requests access to many protected resources such as app-tracking data, location services, or camera, your app should present one request at a time. Wait until the user grants or denies the current authorization request before presenting another request.